﻿using Orleans.EventSourcing;
using Orleans.IGrains;
using System;
using System.Threading.Tasks;
using Orleans.Grains.EventType;
using Orleans.Grains.StateType;
using Orleans.Providers;

namespace Orleans.Grains
{
    /// <summary>
    /// 事件追朔 ,一定要持久层
    /// </summary>
    [StorageProvider(ProviderName = "DevStore")]
    public class EventGrain : JournaledGrain<EventModifiedType, EventModified>, IEvent
    {
        public async Task<bool> Update()
        {
            RaiseEvent(new EventModified() { Amount = 100 });
            Console.WriteLine($"当前版本号：{Version}");
            return await Task.FromResult(true);
        }
    }
}
